include platform.mk

LUA_CLIB_PATH ?= luaclib

LUA_CLIB = webclient cjson

CFLAGS = -g -O2 -Wall -I$(LUA_INC) $(MYCFLAGS)

# lua
LUA_STATICLIB := skynet/3rd/lua/liblua.a
LUA_LIB ?= $(LUA_STATICLIB)
LUA_INC ?= skynet/3rd/lua

all : \
    $(foreach v, $(LUA_CLIB), $(LUA_CLIB_PATH)/$(v).so)

$(LUA_CLIB_PATH)/webclient.so : 3rd/lua-webclient/webclient.c | $(LUA_CLIB_PATH)
	$(CC) $(CFLAGS) $(SHARED) -I3rd/lua-webclient/webclient $^ -o $@ -lcurl
    
$(LUA_CLIB_PATH)/cjson.so::3rd/lua-cjson/*.c
	cd 3rd/lua-cjson && $(MAKE)
	mv 3rd/lua-cjson/cjson.so $(LUA_CLIB_PATH)/